package com.whc.goods.mapper;

import com.whc.goods.domain.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface CartMapper {
    //根据商品id和用户id查询购物车中的商品
    Goods selectCartGoods(@Param("userId") Long userId, @Param("goodsId") Long goodsId);

    //添加单个商品到购物车
    void addGoodsToCart(@Param("userId")Long userId,@Param("goodsId") Long goodsId);

    //清空购物车
    Long deleteAll(@Param("userId")Long userId);

    //从购物车移除多个商品
    Long deleteMany(@Param("userId")Long userId,@Param("goodsIds") List<Long> goodsIds);

    //查询购物车商品列表
    List<Goods> selectGoods(@Param("userId")Long userId);

}
